/**
 * Created by HIAPAD on 2017/11/1.
 */
var moment=require("moment");
var config=require("../config");
var fs=require("fs");
var path=require("path");

console.log(config.errorLog);

exports.errorLog=function(errStr){
    var writeStream=fs.createWriteStream(config.errorLog,{flags: 'a'});
    writeStream.open();
    writeStream.write("\n"+moment(new Date()).format("YYYY-MM-DD HH:mm:ss")+"[error] "+errStr);
    writeStream.close();
}

exports.sqlLog=function(sql){
    var writeStream=fs.createWriteStream(config.sqlLog,{flags: 'a'});
    writeStream.open();
    writeStream.write("\n"+moment(new Date()).format("YYYY-MM-DD HH:mm:ss")+"[error] "+sql);
    writeStream.close();
}

